package com.abvnet.project.water.api.web;

import com.abvnet.framework.web.controller.BaseController;
import com.abvnet.framework.web.domain.AjaxResult;
import com.abvnet.project.water.project.domain.ProjectCustomerTrack;
import com.abvnet.project.water.project.service.IProjectCustomerTrackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/project/track")
public class ApiProjectCustomerTrackController extends BaseController {

    @Autowired
    private IProjectCustomerTrackService projectCustomerTrackService;

    @GetMapping("/list")
    public AjaxResult list(ProjectCustomerTrack projectCustomerTrack) {
        return AjaxResult.success(projectCustomerTrackService.selectProjectCustomerTrackListForApi(projectCustomerTrack));
    }

    @GetMapping("/get")
    public AjaxResult get(@RequestParam("trackId") Long trackId) {
        return AjaxResult.success(projectCustomerTrackService.selectProjectCustomerTrackById(trackId));
    }

    @PostMapping("/add")
    public AjaxResult addSave(ProjectCustomerTrack projectCustomerTrack) {
        return AjaxResult.success(projectCustomerTrackService.insertProjectCustomerTrack(projectCustomerTrack));
    }

    @PostMapping("/edit")
    public AjaxResult editSave(ProjectCustomerTrack projectCustomerTrack) {
        return AjaxResult.success(projectCustomerTrackService.updateProjectCustomerTrack(projectCustomerTrack));
    }
}
